<?php
/**
 * 淘宝地区API
 *
 * Class LogisticsAPI
 */
class AreaAPI {
    /**
     * @var null 淘宝客户端
     */
    private $_client;

    /**
     * @param $options
     *
     * @throws APIException
     */
    public function __construct($options) {
        $client=isset($options[0])?$options[0]:null;
        if(!$client||!$client instanceof TaobaoClient){
            throw new APIException(10001,'淘宝API 客户端载入失败');
        }
        $this->_client=$client;
    }

    /**
     * 获取地区
     *
     * @param $tid
     * @param $out_sid
     * @param $company_code
     *
     * @return mixed
     */
    public function areasGet(){
        return $this->_client->api('taobao.areas.get',  array(
            'fields' => 'id,type,name,parent_id,zip'
        ));
    }

}